package com.net.xpay.partner.controller.partner;

import com.net.common.model.ResultPagedList;
import com.net.xpay.common.domain.partner.Partner;
import com.net.xpay.common.domain.stat.UserTransMonthStat;
import com.net.xpay.common.manager.stat.UserTransMonthStatManager;
import com.net.xpay.core.model.UserTransMonthStatSearchModel;
import com.net.xpay.partner.secutiry.RequestUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 net
 * @description: 用户月转账统计
net
 * @create: 2020-09-12 12:12
 **/
@RestController
@RequestMapping("/partner/user-trans-month-stat")
@Api(tags = "运营/用户月转账统计",description = "用户月转账统计")
public class UserTransMonthStatController {

    @Autowired
    private UserTransMonthStatManager userTransMonthStatManager;

    @ApiOperation(value = "用户转账统计")
    @PostMapping(value = "/search")
    public ResultPagedList<UserTransMonthStat> search(@ApiIgnore @RequestUser Partner partner,@RequestBody UserTransMonthStatSearchModel searchModel){
        searchModel.setUserId(searchModel.getUserId());
        searchModel.setPartnerId(partner.getId());
        // 根据查询条件进行查询
        List<UserTransMonthStat> userTransStatList = userTransMonthStatManager.search(searchModel);
        // 查询带条件后数据的条数
        long count = userTransMonthStatManager.searchCount(searchModel);
        return new ResultPagedList<>(userTransStatList,count,searchModel);
    }
}